
<?php
    $url = new Url();
    $arr_region = LoadConfig::$region;

    //var_dump($arr_region);
?>

<script type="text/javascript">

    $(document).ready(function(){

        $('#calendar').addClass('active');

        loadChat("<?=$url->createUrl('home/chat')?>");

        $('.From').keypress(function(e){
            if(e.keyCode == 13 && !e.shiftKey){
                $(this).trigger("enterKey");
            } 
        });

        $('textarea').bind("enterKey",function(e){
            var messenger = $('.From').val();
            var url = "<?=$url->createUrl('home/chat'); ?>";
            $.ajax({
                type: "GET",
                url: url,
                global: false,
                data: {
                    messenger: messenger,
                },
                success: function(msg){  
                    if(msg==1){
                        alert('Bạn phải đăng nhập để tán gẫu');
                    }
                    else
                    {
                        $("#CHAT").html(msg);
                        $('.From').val('');
                    }

                }
            });
        });

        var currentdate = new Date(); 
        var datetime_mb = currentdate.getFullYear() + "/" + (currentdate.getMonth()+1)  + "/" + (currentdate.getDate()) + " 18:15:00";
        var datetime_mt = currentdate.getFullYear() + "/" + (currentdate.getMonth()+1)  + "/" + (currentdate.getDate()) + " 17:15:00";
        var datetime_mn = currentdate.getFullYear() + "/" + (currentdate.getMonth()+1)  + "/" + (currentdate.getDate()) + " 16:15:00";
        //alert(datetime);
        $('.count_mb').countdown(datetime_mb, function(event) {
            $(this).html(event.strftime('%H:%M:%S'));
        });
        $('.count_mt').countdown(datetime_mt, function(event) {
            $(this).html(event.strftime('%H:%M:%S'));
        });
        $('.count_mn').countdown(datetime_mn, function(event) {
            $(this).html(event.strftime('%H:%M:%S'));
        });
    });

    function loadChat(url){
        var scroll = $('.boxCHAT').scrollTop();
        //alert(scroll);
        $.ajax({
            type: "POST",
            url: url,
            global: false,
            data:{
                
            },
            success:function(msg){
                $("#CHAT").html(msg);
            }
        });
    }

    function messenger(){
        var messenger = $('.From').val();
        var url = "<?=$url->createUrl('home/chat'); ?>";
        $.ajax({
            type: "GET",
            url: url,
            global: false,
            data: {
                messenger: messenger,
            },
            success: function(msg){
                if(msg==1){
                    alert('Bạn phải đăng nhập để tán gẫu');
                }
                else
                {
                    $("#CHAT").html(msg);
                    $('.From').val('');
                }
            }
        });
    };
</script>

<div class="leftMain">
    <div class="titleCHAT">
        <h1>Lịch mở thưởng</h1>
    </div>
    <div class="tableLMT">
        <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#e6e6e6">
            <tr class="bg_xam">
                <td class="dayLMT"><strong class="red">Mở thưởng</strong></td>
                <td class="tinhLMT">
                    <strong>Miền Bắc (mã: MB)</strong><br />
                    Quay lúc: <strong class="red">18h15’</strong><br />
                    Còn <span class="count_mb"></span>
                </td>
                <td class="tinhLMT">
                    <strong>Miền Trung  (mã: MT)</strong><br />
                    Quay lúc: <strong class="red">17h15’</strong><br />  
                    Còn <span class="count_mt"></span>
                </td>
                <td class="tinhLMT">
                    <strong>Miền Nam (mã: MN)</strong><br />
                    Quay lúc: <strong class="red">16h15’</strong><br />
                    Còn <span class="count_mn"></span>
                </td>
            </tr>


            <tr class="bg_white">
                <td class="dayLMT">Thứ 2</td>
                <td class="tinhLMT">
                    <?php for($i=0;$i<count($mon);$i++){?>
                        <?php if($mon[$i]['region'] == 1){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$mon[$i]['alias'],'id'=>$mon[$i]['id'],'code'=>$mon[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $mon[$i]['name'];?></span>: <strong class="red"><?php echo $mon[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>

                <td class="tinhLMT">
                    <?php for($i=0;$i<count($mon);$i++){?>
                        <?php if($mon[$i]['region'] == 2){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$mon[$i]['alias'],'id'=>$mon[$i]['id'],'code'=>$mon[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $mon[$i]['name'];?></span>: <strong class="red"><?php echo $mon[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT">
                    <?php for($i=0;$i<count($mon);$i++){?>
                        <?php if($mon[$i]['region'] == 3){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$mon[$i]['alias'],'id'=>$mon[$i]['id'],'code'=>$mon[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $mon[$i]['name'];?></span>: <strong class="red"><?php echo $mon[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
            </tr>


            <tr>
                <td class="dayLMT bg_white">Thứ 3</td>
                <td class="tinhLMT bg_xam">
                    <?php for($i=0;$i<count($tue);$i++){?>
                        <?php if($tue[$i]['region'] == 1){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$tue[$i]['alias'],'id'=>$tue[$i]['id'],'code'=>$tue[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $tue[$i]['name'];?></span>: <strong class="red"><?php echo $tue[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT bg_xam">
                    <?php for($i=0;$i<count($tue);$i++){?>
                        <?php if($tue[$i]['region'] == 2){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$tue[$i]['alias'],'id'=>$tue[$i]['id'],'code'=>$tue[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $tue[$i]['name'];?></span>: <strong class="red"><?php echo $tue[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT bg_xam">
                    <?php for($i=0;$i<count($tue);$i++){?>
                        <?php if($tue[$i]['region'] == 3){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$tue[$i]['alias'],'id'=>$tue[$i]['id'],'code'=>$tue[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $tue[$i]['name'];?></span>: <strong class="red"><?php echo $tue[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
            </tr>
            <tr class="bg_white">
                <td class="dayLMT">Thứ 4</td>
                <td class="tinhLMT">
                    <?php for($i=0;$i<count($wed);$i++){?>
                        <?php if($wed[$i]['region'] == 1){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$wed[$i]['alias'],'id'=>$wed[$i]['id'],'code'=>$wed[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $wed[$i]['name'];?></span>: <strong class="red"><?php echo $wed[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT">
                    <?php for($i=0;$i<count($wed);$i++){?>
                        <?php if($wed[$i]['region'] == 2){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$wed[$i]['alias'],'id'=>$wed[$i]['id'],'code'=>$wed[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $wed[$i]['name'];?></span>: <strong class="red"><?php echo $wed[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT">
                    <?php for($i=0;$i<count($wed);$i++){?>
                        <?php if($wed[$i]['region'] == 3){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$wed[$i]['alias'],'id'=>$wed[$i]['id'],'code'=>$wed[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $wed[$i]['name'];?></span>: <strong class="red"><?php echo $wed[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
            </tr>
            <tr>
                <td class="dayLMT bg_white">Thứ 5</td>
                <td class="tinhLMT bg_xam">
                    <?php for($i=0;$i<count($thu);$i++){?>
                        <?php if($thu[$i]['region'] == 1){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$thu[$i]['alias'],'id'=>$thu[$i]['id'],'code'=>$thu[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $thu[$i]['name'];?></span>: <strong class="red"><?php echo $thu[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT bg_xam">
                    <?php for($i=0;$i<count($thu);$i++){?>
                        <?php if($thu[$i]['region'] == 2){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$thu[$i]['alias'],'id'=>$thu[$i]['id'],'code'=>$thu[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $thu[$i]['name'];?></span>: <strong class="red"><?php echo $thu[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT bg_xam">
                    <?php for($i=0;$i<count($thu);$i++){?>
                        <?php if($thu[$i]['region'] == 3){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$thu[$i]['alias'],'id'=>$thu[$i]['id'],'code'=>$thu[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $thu[$i]['name'];?></span>: <strong class="red"><?php echo $thu[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
            </tr>
            <tr class="bg_white">
                <td class="dayLMT">Thứ 6</td>
                <td class="tinhLMT">
                    <?php for($i=0;$i<count($fri);$i++){?>
                        <?php if($fri[$i]['region'] == 1){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$fri[$i]['alias'],'id'=>$fri[$i]['id'],'code'=>$fri[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $fri[$i]['name'];?></span>: <strong class="red"><?php echo $fri[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT">
                    <?php for($i=0;$i<count($fri);$i++){?>
                        <?php if($fri[$i]['region'] == 2){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$fri[$i]['alias'],'id'=>$fri[$i]['id'],'code'=>$fri[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $fri[$i]['name'];?></span>: <strong class="red"><?php echo $fri[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT">
                    <?php for($i=0;$i<count($fri);$i++){?>
                        <?php if($fri[$i]['region'] == 3){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$fri[$i]['alias'],'id'=>$fri[$i]['id'],'code'=>$fri[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $fri[$i]['name'];?></span>: <strong class="red"><?php echo $fri[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
            </tr>
            <tr>
                <td class="dayLMT bg_white">Thứ 7</td>
                <td class="tinhLMT bg_xam">
                    <?php for($i=0;$i<count($sat);$i++){?>
                        <?php if($sat[$i]['region'] == 1){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$sat[$i]['alias'],'id'=>$sat[$i]['id'],'code'=>$sat[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $sat[$i]['name'];?></span>: <strong class="red"><?php echo $sat[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT bg_xam">
                    <?php for($i=0;$i<count($sat);$i++){?>
                        <?php if($sat[$i]['region'] == 2){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$sat[$i]['alias'],'id'=>$sat[$i]['id'],'code'=>$sat[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $sat[$i]['name'];?></span>: <strong class="red"><?php echo $sat[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT bg_xam">
                    <?php for($i=0;$i<count($sat);$i++){?>
                        <?php if($sat[$i]['region'] == 3){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$sat[$i]['alias'],'id'=>$sat[$i]['id'],'code'=>$sat[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $sat[$i]['name'];?></span>: <strong class="red"><?php echo $sat[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
            </tr>
            <tr class="bg_white">
                <td class="dayLMT">Chủ nhật</td>
                <td class="tinhLMT">
                    <?php for($i=0;$i<count($sun);$i++){?>
                        <?php if($sun[$i]['region'] == 1){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$sun[$i]['alias'],'id'=>$sun[$i]['id'],'code'=>$sun[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $sun[$i]['name'];?></span>: <strong class="red"><?php echo $sun[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT">
                    <?php for($i=0;$i<count($sun);$i++){?>
                        <?php if($sun[$i]['region'] == 2){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$sun[$i]['alias'],'id'=>$sun[$i]['id'],'code'=>$sun[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $sun[$i]['name'];?></span>: <strong class="red"><?php echo $sun[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
                <td class="tinhLMT">
                    <?php for($i=0;$i<count($sun);$i++){?>
                        <?php if($sun[$i]['region'] == 3){?>
                            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquatheotinh',array('alias'=>$sun[$i]['alias'],'id'=>$sun[$i]['id'],'code'=>$sun[$i]['code']));?>">
                                <span style="color: #000;"><?php echo $sun[$i]['name'];?></span>: <strong class="red"><?php echo $sun[$i]['code'];?></strong><br />
                            </a>
                            <?php }?>
                        <?php }?>
                </td>
            </tr>
        </table>
        <div class="sms_LOTO">
            <?php echo Yii::app()->params['static_sms'];?>
        </div>
    </div>
    <div class="MXH">
        <div id="fb-root" style="float: right;"></div>
        <script>(function(d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=670383849682676&version=v2.0";
            fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));
        </script>
        <div class="fb-like" data-href="http://10h.vn/" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div>
    </div>

    <div class="CHAT">
            
        <div class="titleCHAT">
            Tán Gẫu
        </div>
        
        <div class="CHATarea">
            <textarea name="CHAT" placeholder="Nhập nội dung chat" cols="50" rows="1" class="From"></textarea>
        </div>
        <div style="padding:15px 20px 20px 0; text-align:right;">
            <a href="javascript:void(0);" id="emotion"><img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-yahoo.png" width="22" height="22" style="padding-right:10px;"></a>
            <a href="javascript:void(0);" onclick="loadChat('<?=$url->createUrl('home/chat')?>');"><img src="<?php echo Yii::app()->params['static_url'];?>images/Refresh.png" width="22" height="22" style="padding-right:10px;" /></a>
            <input type="button" onclick="messenger();" class="button_KQ" value="Gửi">
        </div>

        <div class="boxCHAT" id="CHAT"></div>
        
        <?php $this->renderPartial('boxemotion');?>
        
    </div>

</div>
<div class="rightMain">

    <div class="Box" id="boxtienich">
        <?php $this->renderPartial('boxtienich');?>
    </div>

    <div class="Box" id="boxketqua">
        <?php
            $this->renderPartial('boxketqua');
        ?>
    </div>

    <div class="Box" id="boxthongke">
        <?php $this->renderPartial('boxthongke');?>
    </div>

</div>
<div class="both"></div>
